package com.suitsoft.ut.entity.info;

import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.springside.modules.utils.reflection.ConvertUtils;

import com.google.common.collect.Lists;
import com.suitsoft.ut.commons.Constants;
import com.suitsoft.ut.entity.IdEntity;
import com.suitsoft.ut.entity.account.User;
import com.suitsoft.ut.entity.base.Teacher;

/**
 * 用户.
 * 
 * 使用JPA annotation定义ORM关系.
 * 使用Hibernate annotation定义JPA 1.0未覆盖的部分.
 * 
 * @author calvin
 */
@Entity
//表名与类名不相同时重新定义表名.
@Table(name = "LW_INFO")
//默认的缓存策略.
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Info extends IdEntity {

	/** 标题  */
	private String infoTitle;
	/** 内容  */
	private String infoContent;
	/** 附件名  */
	private String infoAttachmentName;
	/** 附件路径  */
	private String infoAttachmentPath;	
	/** 图片  */
	private String infoPicture;
	/** 发布时间 */
	private Date infoTime;
	/** 操作人 */
	private User lastUser;
	


	public void setInfoTitle(String infoTitle) {
		this.infoTitle = infoTitle;
	}


	public String getInfoContent() {
		return infoContent;
	}


	public void setInfoContent(String infoContent) {
		this.infoContent = infoContent;
	}


	public String getInfoAttachmentName() {
		return infoAttachmentName;
	}


	public void setInfoAttachmentName(String infoAttachmentName) {
		this.infoAttachmentName = infoAttachmentName;
	}


	public String getInfoPicture() {
		return infoPicture;
	}


	public void setInfoPicture(String infoPicture) {
		this.infoPicture = infoPicture;
	}

	@ManyToOne(fetch =FetchType.LAZY)
	@JoinColumn (name = "USER_ID")
	public User getLastUser() {
		return lastUser;
	}
	public void setLastUser(User lastUser) {
		this.lastUser = lastUser;
	}

	public String getInfoTitle() {
		return infoTitle;
	}


	public Date getInfoTime() {
		return infoTime;
	}


	public void setInfoTime(Date infoTime) {
		this.infoTime = infoTime;
	}


	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}
	
}